import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const _import = file => require('@/pages/' + file + '.vue').default


/*路由配置参数
meta: {
  index: Number //切换路由页面滑动方向(slideLeft, slideRight)参数
}*/
const routes = [
  {
    path: '/',
    name: 'home',
    component: _import('home/Index'),
    redirect: '/app',
    children: [
      {
        path: 'app',
        name: 'app',
        component: _import('home/App'),
        meta: {
          index: 2
        },
        children: [
          {
            path: 'news',
            name: 'news',
            component: _import('home/news/Index')
          }
        ]
      },
      {
        path: 'contacts',
        name: 'contacts',
        component: _import('home/Contacts'),
        meta: {
          index: 3
        }
      },
      {
        path: 'settings',
        name: 'settings',
        component: _import('home/Settings'),
        meta: {
          index: 4
        }
      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: _import('login/Index'),
    meta: {
      index: 1
    }
  },
  {
    path: '/work',
    name: 'work',
    component: _import('work/Index'),
    children: [
      {
        path: 'my-todos',
        name: 'myTodos',
        component: _import('work/myTodos/Index'),
        children: [
          {
            path: 'document/details',
            name: 'docDetail',
            component: _import('work/myTodos/Details')
          }
        ]
      },
      {
        path: 'task-done',
        name: 'taskDone',
        component: _import('work/taskDone/Index'),
        children: [
          {
            path: 'task/details',
            name: 'taskDetail',
            component: _import('work/taskDone/Details')
          }
        ]
      },
      {
        path: 'dispatches',
        name: 'dispatches',
        component: _import('work/dispatches/Index'),
        children: [
          {
            path: 'search-list',
            name: 'dispatchSearchList',
            component: _import('work/dispatches/SearchList')
          }
        ]
      }
    ]
  },
  {
    path:'/record',
    name:'record',
    component:_import('record/Index'),
    children:[
      {
        path:'search-record',
        name:'searchRecord',
        component:_import('record/Search'),
        children:[
          {
            path:'record-list',
            name:'recordList',
            component:_import('record/recordList')
          }
        ]
      },
      {
        path:'add-record',
        name:'addRecord',
        component:_import('record/addRecord')
      }
    ]

  },
  {
    path: '/tasks',
    name: 'tasks',
    component: _import('tasks/Index'),
    children: [
      {
        path: 'tasks-details',
        name: 'TaskDetails',
        component: _import('tasks/TaskDetails')
      }
    ]
  },
  {
    path: '/finance',
    name: 'finance',
    component: _import('finance/Index'),
    children:[
      {
      	path:'finance-todo',
      	name:'financeTodo',
      	component:_import('finance/financeTodo/Index'),
      	children:[
          {
            path:'document/Fdetails',
            name:'FinnanceDetails',
            component:_import('finance/financeTodo/Fdetails')
          }
      	]
      }
    ]
  },
  {
    path: '/todos',
    name: 'todos',
    component: _import('todos/Index'),
    children: [
      {
        path: 'bussiness',
        name: 'bussiness',
        component: _import('todos/bussiness/Index'),
        children: [
          {
            path: 'detail',
            name: 'bussinessDtail',
            component: _import('todos/bussiness/Detail')
          }
        ]
      }
    ]
  },
  {
    path: '/announcements',
    name: 'announcements',
    component: _import('announcements/Index'),
    children: [
      {
        path: '/details',
        name: 'annDetails',
        component: _import('announcements/Details')
      }
    ]
  },
  {
    path: '/meal',
    name: 'meal',
    component: _import('meal/Index'),
    children: [
      {
        path: 'orders',
        name: 'orders',
        component: _import('meal/Orders')
      }
    ]
  },
  {
    path: '/location',
    name: 'location',
    component: _import('location/Index')
  },
  {
    path: '/leave',
    name: 'leave',
    component: _import('leave/index'),
    children: [
      {
        path: 'leave',
        name: 'leaveDetails',
        component: _import('leave/leavedetails')
      }
    ]
  }
  // {
  //   path: 'attendance',
  //   name: 'attendance',
  //   component: _import('attendance/Index')
  // }
]

export default new Router({
  routes
})
